import { createApp } from 'vue'
import App from './App.vue'
import router from './router'
import axios from 'axios'
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import { ElLoading } from 'element-plus'

const app = createApp(App)
let isLoading = null

// 全局配置 axios
// axios.defaults.baseURL = 'http://127.0.0.1/api/'
// // 配置请求拦截器
// axios.interceptors.request.use(config => {
//   console.log(config)
//   // 为当前请求配置 token 请求头
//   config.headers.Authorization = 'Bearer xxx'
//   isLoading = ElLoading.service({ fullscreen: true })
//   console.log(config)
//   return config
// })
// axios 请求成功的回调  response
axios.interceptors.response.use(response => {
  // isLoading.close()
  return response
})
app.config.globalProperties.$http = axios


app.use(ElementPlus)
app.use(router)

app.mount('#app')
